package java101;

public class PrimeNumber1 {

	public static void main(String[] args) {
		
		int i;
		int count = 0;
		
for (i = 1; i < 1000; i += 2){
					
	
	if (i < 2){
		count++;
		System.out.println("2 is prime.\t");
		}
	
	else if (i > 2 && isPrime(i) == true){
	count++;
	System.out.println(i + " is prime.\t");
}
}
System.out.println("I found " + count + " prime numbers less than 1000!");
}		
		
		

	private static boolean isPrime(int primeNum) {
		boolean prime = true;
		for (int a = 2; a <= Math.sqrt(primeNum); a++){
			if (primeNum%a == 0)
			{
				prime = false;
				break;
			}
			
	}		
	return (prime);
}
}
